﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using CrudCategories.Web;

namespace MasterDetail
{
    public partial class MainPage : UserControl
    {
        private DomainServiceEarth dsEarth;

        public MainPage()
        {
            InitializeComponent();
            this.dsEarth = new DomainServiceEarth();
            dsEarth.Load(dsEarth.GetCountriesQuery());
            listBoxCountries.ItemsSource = dsEarth.Countries;
            listBoxCountries.DisplayMemberPath = "CountryName";
            listBoxCountries.SelectedValuePath = "CountryID";
        }

        private void listBoxCountries_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessageBox.Show(listBoxCountries.SelectedValue.ToString());
        }
    }
}
